﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _17_Lambda表达式结合数组
{
    internal class Program
    {
        static void Main(string[] args)
        {
            People people = new People();
            people.Add(new Person("张三", 18, "男", "123-456"));
            people.Add(new Person("翠花", 19, "女", "654-789"));
            people.Add(new Person("王五", 20, "男", "874-574"));
            people.Add(new Person("秀琴", 19, "女", "654-789"));
            people.Add(new Person("静香", 21, "女", "897-754"));

            people.ForeEach(DoSome);

            Console.WriteLine("===================================================");

            people.ForeEach(delegate (Person person) { return person.Gender == "女"; }) ;

            Console.WriteLine("===================================================");

            people.ForeEach(person => person.Gender == "男");

            Console.WriteLine("===================================================");

            people.ForeEach(person => person.Age>18);

            Console.WriteLine("===================================================");

            people.FindAll(t => t.Gender == "女" && t.Age == 19).ForEach(t => t.Print());


            Console.ReadKey();
        }

        public static bool DoSome(Person person)
        {
            return person.Gender == "女";
        }

    }
}
